<?php
defined ( 'BASEPATH' ) or exit ( 'No direct script access allowed' );
class Pricestate_model extends CI_Model {
	public function __construct() {
		parent::__construct ();
	}
	/*
	 * 添加价格变动状态
	 */
	public function create($pricestate) {
		$this->db->insert ( 't_pricestate', $pricestate );
		return $this->db->insert_id ();
	}
	/*
	 * 更新价格变动状态
	 */
	public function update($id,$pricestate){
		$this->db->where('id', $id);
		return $this->db->update('t_pricestate', $pricestate);
	}
	/*
	 * 根据商品ID得到价格变动状态
	 */
	public function find_by_product($productid){
		$this->db->where('productid', $productid);
		$query = $this->db->get('t_pricestate');
		return $query->row_array();
	}
}